package str

func truncateSentence(s string, k int) string {
	count := 0
	var i int

	for i = 0; i < len(s); i++ {
		if s[i] == ' ' {
			count++
		}
		if count == k {
			break
		}
	}

	return s[:i]
}
